package edu.unf.cen6940.web;

import edu.unf.cen6940.dao.FacultyDAO;
import edu.unf.cen6940.dao.FacultyresearchDAO;
import edu.unf.cen6940.dao.FacultyresearchtostudentDAO;
import edu.unf.cen6940.dao.StudentDAO;

import edu.unf.cen6940.domain.Faculty;
import edu.unf.cen6940.domain.Facultyresearch;
import edu.unf.cen6940.domain.Facultyresearchtostudent;
import edu.unf.cen6940.domain.Student;

import edu.unf.cen6940.service.FacultyresearchtostudentService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.WebDataBinder;

import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import org.springframework.web.servlet.ModelAndView;

/**
 * Spring MVC controller that handles CRUD requests for Facultyresearchtostudent entities
 * 
 */

@Controller("FacultyresearchtostudentController")
public class FacultyresearchtostudentController {

	/**
	 * DAO injected by Spring that manages Faculty entities
	 * 
	 */
	@Autowired
	private FacultyDAO facultyDAO;

	/**
	 * DAO injected by Spring that manages Facultyresearch entities
	 * 
	 */
	@Autowired
	private FacultyresearchDAO facultyresearchDAO;

	/**
	 * DAO injected by Spring that manages Facultyresearchtostudent entities
	 * 
	 */
	@Autowired
	private FacultyresearchtostudentDAO facultyresearchtostudentDAO;

	/**
	 * DAO injected by Spring that manages Student entities
	 * 
	 */
	@Autowired
	private StudentDAO studentDAO;

	/**
	 * Service injected by Spring that provides CRUD operations for Facultyresearchtostudent entities
	 * 
	 */
	@Autowired
	private FacultyresearchtostudentService facultyresearchtostudentService;

	/**
	 * Create a new Facultyresearchtostudent entity
	 * 
	 */
	@RequestMapping("/newFacultyresearchtostudent")
	public ModelAndView newFacultyresearchtostudent() {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudent", new Facultyresearchtostudent());
		mav.addObject("newFlag", true);
		mav.setViewName("facultyresearchtostudent/editFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Entry point to show all Facultyresearchtostudent entities
	 * 
	 */
	public String indexFacultyresearchtostudent() {
		return "redirect:/indexFacultyresearchtostudent";
	}

	/**
	 * Edit an existing Facultyresearch entity
	 * 
	 */
	@RequestMapping("/editFacultyresearchtostudentFacultyresearch")
	public ModelAndView editFacultyresearchtostudentFacultyresearch(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer facultyresearch_facultyResearchId) {
		Facultyresearch facultyresearch = facultyresearchDAO.findFacultyresearchByPrimaryKey(facultyresearch_facultyResearchId, -1, -1);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearch", facultyresearch);
		mav.setViewName("facultyresearchtostudent/facultyresearch/editFacultyresearch.jsp");

		return mav;
	}

	/**
	 * Create a new Facultyresearch entity
	 * 
	 */
	@RequestMapping("/newFacultyresearchtostudentFacultyresearch")
	public ModelAndView newFacultyresearchtostudentFacultyresearch(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId) {
		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearch", new Facultyresearch());
		mav.addObject("newFlag", true);
		mav.setViewName("facultyresearchtostudent/facultyresearch/editFacultyresearch.jsp");

		return mav;
	}

	/**
	 * View an existing Student entity
	 * 
	 */
	@RequestMapping("/selectFacultyresearchtostudentStudent")
	public ModelAndView selectFacultyresearchtostudentStudent(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer student_studentId) {
		Student student = studentDAO.findStudentByPrimaryKey(student_studentId, -1, -1);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("student", student);
		mav.setViewName("facultyresearchtostudent/student/viewStudent.jsp");

		return mav;
	}

	/**
	 * Register custom, context-specific property editors
	 * 
	 */
	@InitBinder
	public void initBinder(WebDataBinder binder, HttpServletRequest request) { // Register static property editors.
		binder.registerCustomEditor(java.util.Calendar.class, new org.skyway.spring.util.databinding.CustomCalendarEditor());
		binder.registerCustomEditor(byte[].class, new org.springframework.web.multipart.support.ByteArrayMultipartFileEditor());
		binder.registerCustomEditor(boolean.class, new org.skyway.spring.util.databinding.EnhancedBooleanEditor(false));
		binder.registerCustomEditor(Boolean.class, new org.skyway.spring.util.databinding.EnhancedBooleanEditor(true));
		binder.registerCustomEditor(java.math.BigDecimal.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(java.math.BigDecimal.class, true));
		binder.registerCustomEditor(Integer.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Integer.class, true));
		binder.registerCustomEditor(java.util.Date.class, new org.skyway.spring.util.databinding.CustomDateEditor());
		binder.registerCustomEditor(String.class, new org.skyway.spring.util.databinding.StringEditor());
		binder.registerCustomEditor(Long.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Long.class, true));
		binder.registerCustomEditor(Double.class, new org.skyway.spring.util.databinding.NaNHandlingNumberEditor(Double.class, true));
	}

	/**
	 */
	@RequestMapping("/facultyresearchtostudentController/binary.action")
	public ModelAndView streamBinary(@ModelAttribute HttpServletRequest request, @ModelAttribute HttpServletResponse response) {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("streamedBinaryContentView");
		return mav;

	}

	/**
	 * Show all Facultyresearch entities by Facultyresearchtostudent
	 * 
	 */
	@RequestMapping("/listFacultyresearchtostudentFacultyresearch")
	public ModelAndView listFacultyresearchtostudentFacultyresearch(@RequestParam Integer facultyResearchIdKey, @RequestParam Integer studentIdKey, @RequestParam Integer facultyIdKey) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudent", facultyresearchtostudentDAO.findFacultyresearchtostudentByPrimaryKey(facultyResearchIdKey, studentIdKey, facultyIdKey));
		mav.setViewName("facultyresearchtostudent/facultyresearch/listFacultyresearch.jsp");

		return mav;
	}

	/**
	 * Select the child Facultyresearch entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@RequestMapping("/confirmDeleteFacultyresearchtostudentFacultyresearch")
	public ModelAndView confirmDeleteFacultyresearchtostudentFacultyresearch(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer related_facultyresearch_facultyResearchId) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearch", facultyresearchDAO.findFacultyresearchByPrimaryKey(related_facultyresearch_facultyResearchId));
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.setViewName("facultyresearchtostudent/facultyresearch/deleteFacultyresearch.jsp");

		return mav;
	}

	/**
	 * Show all Facultyresearchtostudent entities
	 * 
	 */
	@RequestMapping("/indexFacultyresearchtostudent")
	public ModelAndView listFacultyresearchtostudents() {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudents", facultyresearchtostudentService.loadFacultyresearchtostudents());

		mav.setViewName("facultyresearchtostudent/listFacultyresearchtostudents.jsp");

		return mav;
	}

	/**
	 * Save an existing Student entity
	 * 
	 */
	@RequestMapping("/saveFacultyresearchtostudentStudent")
	public ModelAndView saveFacultyresearchtostudentStudent(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @ModelAttribute Student student) {
		Facultyresearchtostudent parent_facultyresearchtostudent = facultyresearchtostudentService.saveFacultyresearchtostudentStudent(facultyresearchtostudent_facultyResearchId, facultyresearchtostudent_studentId, facultyresearchtostudent_facultyId, student);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearchtostudent", parent_facultyresearchtostudent);
		mav.setViewName("facultyresearchtostudent/viewFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Show all Student entities by Facultyresearchtostudent
	 * 
	 */
	@RequestMapping("/listFacultyresearchtostudentStudent")
	public ModelAndView listFacultyresearchtostudentStudent(@RequestParam Integer facultyResearchIdKey, @RequestParam Integer studentIdKey, @RequestParam Integer facultyIdKey) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudent", facultyresearchtostudentDAO.findFacultyresearchtostudentByPrimaryKey(facultyResearchIdKey, studentIdKey, facultyIdKey));
		mav.setViewName("facultyresearchtostudent/student/listStudent.jsp");

		return mav;
	}

	/**
	 * Delete an existing Faculty entity
	 * 
	 */
	@RequestMapping("/deleteFacultyresearchtostudentFaculty")
	public ModelAndView deleteFacultyresearchtostudentFaculty(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer related_faculty_facultyId) {
		ModelAndView mav = new ModelAndView();

		Facultyresearchtostudent facultyresearchtostudent = facultyresearchtostudentService.deleteFacultyresearchtostudentFaculty(facultyresearchtostudent_facultyResearchId, facultyresearchtostudent_studentId, facultyresearchtostudent_facultyId, related_faculty_facultyId);

		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearchtostudent", facultyresearchtostudent);
		mav.setViewName("facultyresearchtostudent/viewFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Save an existing Facultyresearchtostudent entity
	 * 
	 */
	@RequestMapping("/saveFacultyresearchtostudent")
	public String saveFacultyresearchtostudent(@ModelAttribute Facultyresearchtostudent facultyresearchtostudent) {
		facultyresearchtostudentService.saveFacultyresearchtostudent(facultyresearchtostudent);
		return "forward:/indexFacultyresearchtostudent";
	}

	/**
	 * Save an existing Facultyresearch entity
	 * 
	 */
	@RequestMapping("/saveFacultyresearchtostudentFacultyresearch")
	public ModelAndView saveFacultyresearchtostudentFacultyresearch(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @ModelAttribute Facultyresearch facultyresearch) {
		Facultyresearchtostudent parent_facultyresearchtostudent = facultyresearchtostudentService.saveFacultyresearchtostudentFacultyresearch(facultyresearchtostudent_facultyResearchId, facultyresearchtostudent_studentId, facultyresearchtostudent_facultyId, facultyresearch);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearchtostudent", parent_facultyresearchtostudent);
		mav.setViewName("facultyresearchtostudent/viewFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Show all Faculty entities by Facultyresearchtostudent
	 * 
	 */
	@RequestMapping("/listFacultyresearchtostudentFaculty")
	public ModelAndView listFacultyresearchtostudentFaculty(@RequestParam Integer facultyResearchIdKey, @RequestParam Integer studentIdKey, @RequestParam Integer facultyIdKey) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudent", facultyresearchtostudentDAO.findFacultyresearchtostudentByPrimaryKey(facultyResearchIdKey, studentIdKey, facultyIdKey));
		mav.setViewName("facultyresearchtostudent/faculty/listFaculty.jsp");

		return mav;
	}

	/**
	 * Save an existing Faculty entity
	 * 
	 */
	@RequestMapping("/saveFacultyresearchtostudentFaculty")
	public ModelAndView saveFacultyresearchtostudentFaculty(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @ModelAttribute Faculty faculty) {
		Facultyresearchtostudent parent_facultyresearchtostudent = facultyresearchtostudentService.saveFacultyresearchtostudentFaculty(facultyresearchtostudent_facultyResearchId, facultyresearchtostudent_studentId, facultyresearchtostudent_facultyId, faculty);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearchtostudent", parent_facultyresearchtostudent);
		mav.setViewName("facultyresearchtostudent/viewFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Edit an existing Student entity
	 * 
	 */
	@RequestMapping("/editFacultyresearchtostudentStudent")
	public ModelAndView editFacultyresearchtostudentStudent(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer student_studentId) {
		Student student = studentDAO.findStudentByPrimaryKey(student_studentId, -1, -1);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("student", student);
		mav.setViewName("facultyresearchtostudent/student/editStudent.jsp");

		return mav;
	}

	/**
	 * Create a new Student entity
	 * 
	 */
	@RequestMapping("/newFacultyresearchtostudentStudent")
	public ModelAndView newFacultyresearchtostudentStudent(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId) {
		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("student", new Student());
		mav.addObject("newFlag", true);
		mav.setViewName("facultyresearchtostudent/student/editStudent.jsp");

		return mav;
	}

	/**
	 * Select the child Faculty entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@RequestMapping("/confirmDeleteFacultyresearchtostudentFaculty")
	public ModelAndView confirmDeleteFacultyresearchtostudentFaculty(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer related_faculty_facultyId) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("faculty", facultyDAO.findFacultyByPrimaryKey(related_faculty_facultyId));
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.setViewName("facultyresearchtostudent/faculty/deleteFaculty.jsp");

		return mav;
	}

	/**
	 * Select the child Student entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@RequestMapping("/confirmDeleteFacultyresearchtostudentStudent")
	public ModelAndView confirmDeleteFacultyresearchtostudentStudent(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer related_student_studentId) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("student", studentDAO.findStudentByPrimaryKey(related_student_studentId));
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.setViewName("facultyresearchtostudent/student/deleteStudent.jsp");

		return mav;
	}

	/**
	 * Select the Facultyresearchtostudent entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@RequestMapping("/confirmDeleteFacultyresearchtostudent")
	public ModelAndView confirmDeleteFacultyresearchtostudent(@RequestParam Integer facultyResearchIdKey, @RequestParam Integer studentIdKey, @RequestParam Integer facultyIdKey) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudent", facultyresearchtostudentDAO.findFacultyresearchtostudentByPrimaryKey(facultyResearchIdKey, studentIdKey, facultyIdKey));
		mav.setViewName("facultyresearchtostudent/deleteFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * View an existing Facultyresearch entity
	 * 
	 */
	@RequestMapping("/selectFacultyresearchtostudentFacultyresearch")
	public ModelAndView selectFacultyresearchtostudentFacultyresearch(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer facultyresearch_facultyResearchId) {
		Facultyresearch facultyresearch = facultyresearchDAO.findFacultyresearchByPrimaryKey(facultyresearch_facultyResearchId, -1, -1);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearch", facultyresearch);
		mav.setViewName("facultyresearchtostudent/facultyresearch/viewFacultyresearch.jsp");

		return mav;
	}

	/**
	 * Delete an existing Student entity
	 * 
	 */
	@RequestMapping("/deleteFacultyresearchtostudentStudent")
	public ModelAndView deleteFacultyresearchtostudentStudent(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer related_student_studentId) {
		ModelAndView mav = new ModelAndView();

		Facultyresearchtostudent facultyresearchtostudent = facultyresearchtostudentService.deleteFacultyresearchtostudentStudent(facultyresearchtostudent_facultyResearchId, facultyresearchtostudent_studentId, facultyresearchtostudent_facultyId, related_student_studentId);

		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearchtostudent", facultyresearchtostudent);
		mav.setViewName("facultyresearchtostudent/viewFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Select an existing Facultyresearchtostudent entity
	 * 
	 */
	@RequestMapping("/selectFacultyresearchtostudent")
	public ModelAndView selectFacultyresearchtostudent(@RequestParam Integer facultyResearchIdKey, @RequestParam Integer studentIdKey, @RequestParam Integer facultyIdKey) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudent", facultyresearchtostudentDAO.findFacultyresearchtostudentByPrimaryKey(facultyResearchIdKey, studentIdKey, facultyIdKey));
		mav.setViewName("facultyresearchtostudent/viewFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Edit an existing Facultyresearchtostudent entity
	 * 
	 */
	@RequestMapping("/editFacultyresearchtostudent")
	public ModelAndView editFacultyresearchtostudent(@RequestParam Integer facultyResearchIdKey, @RequestParam Integer studentIdKey, @RequestParam Integer facultyIdKey) {
		ModelAndView mav = new ModelAndView();

		mav.addObject("facultyresearchtostudent", facultyresearchtostudentDAO.findFacultyresearchtostudentByPrimaryKey(facultyResearchIdKey, studentIdKey, facultyIdKey));
		mav.setViewName("facultyresearchtostudent/editFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Delete an existing Facultyresearch entity
	 * 
	 */
	@RequestMapping("/deleteFacultyresearchtostudentFacultyresearch")
	public ModelAndView deleteFacultyresearchtostudentFacultyresearch(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer related_facultyresearch_facultyResearchId) {
		ModelAndView mav = new ModelAndView();

		Facultyresearchtostudent facultyresearchtostudent = facultyresearchtostudentService.deleteFacultyresearchtostudentFacultyresearch(facultyresearchtostudent_facultyResearchId, facultyresearchtostudent_studentId, facultyresearchtostudent_facultyId, related_facultyresearch_facultyResearchId);

		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("facultyresearchtostudent", facultyresearchtostudent);
		mav.setViewName("facultyresearchtostudent/viewFacultyresearchtostudent.jsp");

		return mav;
	}

	/**
	 * Delete an existing Facultyresearchtostudent entity
	 * 
	 */
	@RequestMapping("/deleteFacultyresearchtostudent")
	public String deleteFacultyresearchtostudent(@RequestParam Integer facultyResearchIdKey, @RequestParam Integer studentIdKey, @RequestParam Integer facultyIdKey) {
		Facultyresearchtostudent facultyresearchtostudent = facultyresearchtostudentDAO.findFacultyresearchtostudentByPrimaryKey(facultyResearchIdKey, studentIdKey, facultyIdKey);
		facultyresearchtostudentService.deleteFacultyresearchtostudent(facultyresearchtostudent);
		return "forward:/indexFacultyresearchtostudent";
	}

	/**
	 * Edit an existing Faculty entity
	 * 
	 */
	@RequestMapping("/editFacultyresearchtostudentFaculty")
	public ModelAndView editFacultyresearchtostudentFaculty(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer faculty_facultyId) {
		Faculty faculty = facultyDAO.findFacultyByPrimaryKey(faculty_facultyId, -1, -1);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("faculty", faculty);
		mav.setViewName("facultyresearchtostudent/faculty/editFaculty.jsp");

		return mav;
	}

	/**
	 * Create a new Faculty entity
	 * 
	 */
	@RequestMapping("/newFacultyresearchtostudentFaculty")
	public ModelAndView newFacultyresearchtostudentFaculty(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId) {
		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("faculty", new Faculty());
		mav.addObject("newFlag", true);
		mav.setViewName("facultyresearchtostudent/faculty/editFaculty.jsp");

		return mav;
	}

	/**
	 * View an existing Faculty entity
	 * 
	 */
	@RequestMapping("/selectFacultyresearchtostudentFaculty")
	public ModelAndView selectFacultyresearchtostudentFaculty(@RequestParam Integer facultyresearchtostudent_facultyResearchId, @RequestParam Integer facultyresearchtostudent_studentId, @RequestParam Integer facultyresearchtostudent_facultyId, @RequestParam Integer faculty_facultyId) {
		Faculty faculty = facultyDAO.findFacultyByPrimaryKey(faculty_facultyId, -1, -1);

		ModelAndView mav = new ModelAndView();
		mav.addObject("facultyresearchtostudent_facultyResearchId", facultyresearchtostudent_facultyResearchId);
		mav.addObject("facultyresearchtostudent_studentId", facultyresearchtostudent_studentId);
		mav.addObject("facultyresearchtostudent_facultyId", facultyresearchtostudent_facultyId);
		mav.addObject("faculty", faculty);
		mav.setViewName("facultyresearchtostudent/faculty/viewFaculty.jsp");

		return mav;
	}
}